package com.lhd.shop.controller;

import dto.MenuDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import service.FrontDeskService;
import vo.ResponseData;

import java.util.List;

/**
 * @program: sporadic
 * @description:
 * @author: LHD   QQ:1727865856
 * @create: 2019-11-13 15:20
 **/
@RestController
@RequestMapping("/menu")
@CrossOrigin
public class MenuController {
    @Autowired
    private FrontDeskService frontDeskService;

    @GetMapping("/queryMenu")
    public ResponseData<List<MenuDTO>> menu(Integer mid) {
        ResponseData<List<MenuDTO>> query = frontDeskService.query(mid);
        return query.getBody().isEmpty() ? new ResponseData<>(null, "空") : query;
    }
}
